<template>
	<view class="grid" :style="{height:screenH/9 + 'px'}">
		<view class="item" v-for="(item,index) in buttonsList" @click="checkButton(index)">
			<image :src="item.src" mode="aspectFill" :style="{height:screenH/10 + 'rpx',width:screenH/10 + 'rpx'}"></image>
			<text>{{item.title}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				buttonsList: [{
						title: "电脑配件",
						src: "/static/hongbao.png"
					},
					{
						title: "整机出售",
						src: "/static/jinritehui.png"
					},
					{	
						title: "手机平板",
						src: "/static/monizhuangji.png"
					},
					{
						title: "二手买卖",
						src: "/static/ershoumaimai.png"
					}
				],
				screenW:0,
				screenH:0
			};
		},
		async created() {
			await this.$getSystemInfo().then(res=>{
				this.screenW = res.screenWidth
				this.screenH = res.screenHeight
			})
		},
		methods: {
			checkButton(index) {
				uni.navigateTo({
					url: "/pages/tabber/shop/buttomsPage/buttomsPage?type="+index+"&title="+this.buttonsList[index].title
				})
			}
		}
	}
</script>

<style lang="scss">
	.grid {
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		.item{
			flex-grow: 1;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			text{
				font-size: 24rpx;
			}
		}
	}
</style>
